<?php
class Action extends admin_abs
{
	function index(){
		
		$model_id = _GET('mid', 0);
		
		
		$model = _model('admin_attribute')->getList('where model_id = '.$model_id.' order by view_order desc');
		
		for($i=0,$b=count($model);$i<=$b;$i++){
			
			$x[]=$model[$i]['type'];
			
		}
		
		$a=null;
		
		if(in_array('file', $x)){
			
			$a.="<form action= method='post' enctype='multipart/form-data'>";
			
		}else{
			
			$a.= "<form action= method='post' >";
		}
		
		
		foreach($model as $val){
			
			if($val['type'] == 'select'){
				$val['value']=nl2br($val['value']);
				
				$new = explode("\n",$val['value']);
				
				$a.="<select name={$val['name']}>";
				
				foreach($new as $newval){
					$a.= "<option value =".$newval.">$newval</option>";
					
				}
				$a.="</select><br>";
			}
			if($val['type'] == 'input'){
				
				$a.= "<input type='text' name={$val['name']}  value ={$val['value']}><br>";
				
			}
			if($val['type'] == 'text'){
				
				$a.="<textarea name={$val['name']}>{$val['value']}</textarea><br>";
				
			}
			if($val['type'] == 'file'){
				
				$a.= "<input type='hidden' name='MAX_FILE_SIZE' value=30000 ><input name={$VAL['name']} type='file' />";
				
			}
			
		}
		$a.="</form>";
		
		echo $a;
		echo 1111;
		
	}
}